package com.situ.shop.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.situ.model.ProductCategory;
import com.situ.utils.AuditEntity;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 秒杀商品模型
 */

@Getter
@Setter
@TableName("seckill_product")
public class SecKillProduct extends AuditEntity {
    @TableId(type = IdType.AUTO)
    private Integer id; //秒杀商品id

    private Integer productId; //关联商品id

    private BigDecimal seckillPrice; //秒杀价格

    private Integer stock; //秒杀库存

    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS")
    private LocalDateTime startTime; //秒杀开始时间

    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS")
    private LocalDateTime endTime; //秒杀结束时间

    @TableField(exist = false)//不存在数据库中,手动设值
    private ProductCategory category;//商品类别


    private Integer status; // 秒杀状态 0:上架中 1:下架

    private String avatar;//商品图片
}
